@echo off
echo Building and running MouseKeyboardOperationSimulator project...
echo.

REM Build the project
echo Building project...
"C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\MSBuild.exe" "MouseKeyboardOperationSimulator.sln" /p:Configuration=Debug

if %errorlevel% equ 0 (
    echo.
    echo Project built successfully!
    echo.
    
    REM Run the application
    echo Starting application...
    if exist "MouseKeyboardOperationSimulator\bin\Debug\MouseKeyboardOperationSimulator.exe" (
        start "" "MouseKeyboardOperationSimulator\bin\Debug\MouseKeyboardOperationSimulator.exe"
        echo Application started.
    ) else (
        echo Error: Executable file not found.
    )
) else (
    echo.
    echo Project build failed, please check the error message.
)

REM pause